const event = require("./event")
const collection = require("./collection")

module.exports = class db {
    name;
    qiuya;
    collections = {}

    constructor(qiuya, name) {
        this.qiuya = qiuya
        this.name = name
    }

    async show(){
        return this.qiuya.send(event.COMMAND_SHOW_COLS, {
            db: this.name
        })
    }

    collection(colName){
        return this.collections[colName] || (this.collections[colName] = new collection(this, colName))
    }
}